<!DOCTYPE html>
<html>
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
  <title>百度地图离线API V2.1  www.xiaoguo123.com</title>
	<style type="text/css">
  body, html,#map_demo, #tab, #mapfrm {width: 100%;height: 100%;overflow: hidden;margin:0;font-family:"微软雅黑";}
  #menu{height:100%;overflow-y:auto}
  td{font-size:14px}
  h4{margin:0;}
  #map_demo1,#map_demo2{height: 50%}
  </style>
  <script type="text/javascript" src="../../offlinemap/map_load.js"></script>
  <link rel="stylesheet" type="text/css" href="../../offlinemap/css/map.css"/>
  
  <script type="text/javascript" src="../jquery.js"></script>
  <script type="text/javascript" src="../layer/layer.js"></script>
</head>
<body>
<div id="map_demo">1</div>
</body>
</html>
<script type="text/javascript">  
// 百度地图API功能
	var map = new BMap.Map("map_demo");
	var point = new BMap.Point(116.418261, 39.921984);
	map.centerAndZoom(point, 8);
	map.enableScrollWheelZoom();                        //启用滚轮放大缩小
  
	var marker = new BMap.Marker(new BMap.Point(113.404, 39.915)); // 创建点
	map.addOverlay(marker);            //增加点
	marker.addEventListener("click",overlay_style);
	
	var polyline = new BMap.Polyline([
		new BMap.Point(116.383752, 39.91334),
		new BMap.Point(113.38792, 39.920866),
		new BMap.Point(114.390867, 39.906532)
	], {strokeColor:"blue", strokeWeight:6, strokeOpacity:0.5});   //创建折线
	map.addOverlay(polyline);          //增加折线
	polyline.addEventListener("click",overlay_style);
		
	var circle = new BMap.Circle(new BMap.Point(116.415157, 39.914004),19500,{strokeColor:"blue", strokeWeight:6, strokeOpacity:0.5}); //创建圆
	map.addOverlay(circle);            //增加圆
	circle.addEventListener("click",overlay_style);
	
	//获取marker的属性
	function overlay_style(e){
		var p = e.target;
		if(p instanceof BMap.Marker){
			layer.open({'content':"该覆盖物是点，点的坐标是：" + p.getPosition().lng + "," + p.getPosition().lat});   
		}else if(p instanceof BMap.Circle){
			layer.open({'content':"该覆盖物是圆，圆的半径是：" + p.getRadius() + "，圆的中心点坐标是：" + p.getCenter().lng + "," + p.getCenter().lat});   
		}else if(p instanceof BMap.Polyline){
			layer.open({'content':"该覆盖物是折线，所画点的个数是：" + p.getPath().length});   
		}else{
			layer.open({'content':"无法获知该覆盖物类型"});
		}
	}	
	
	layer.msg('点击覆盖物试试');
</script>